var e = require;
var t = module;
var o = exports;
var n = o;
Object.defineProperty(n, "__esModule", {value: !0}), (n.BevNode = void 0);
var i = e("BehaviorTree"),
    a = (function () {
        function e(e, t) {
            void 0 === t && (t = null),
                (this.mao_ChildNodeList = new Array(i.k_BLimited_MaxChildNodeCnt)),
                (this.mul_ChildNodeCount = 0),
                (this.mz_DebugName = "UNNAMED"),
                (this.mo_ActiveNode = null),
                (this.mo_LastActiveNode = null),
                (this.mo_NodePrecondition = null);
            for (var o = 0; o < i.k_BLimited_MaxChildNodeCnt; ++o) this.mao_ChildNodeList[o] = null;
            this._SetParentNode(e), this.SetNodePrecondition(t);
        }
        return (
            (e.prototype.Evaluate = function (e) {
                return (
                    (null === this.mo_NodePrecondition || this.mo_NodePrecondition.ExternalCondition(e)) &&
                    this._DoEvaluate(e)
                );
            }),
            (e.prototype.Transition = function (e) {
                this._DoTransition(e);
            }),
            (e.prototype.Tick = function (e, t) {
                return this._DoTick(e, t);
            }),
            (e.prototype.AddChildNode = function (e) {
                return this.mul_ChildNodeCount === i.k_BLimited_MaxChildNodeCnt
                    ? (game.warn("The number of child nodes is up to 16"), this)
                    : ((this.mao_ChildNodeList[this.mul_ChildNodeCount] = e), ++this.mul_ChildNodeCount, this);
            }),
            (e.prototype.SetNodePrecondition = function (e) {
                return this.mo_NodePrecondition !== e && (this.mo_NodePrecondition = e), this;
            }),
            (e.prototype.SetDebugName = function (e) {
                return (this.mz_DebugName = e), this;
            }),
            (e.prototype.oGetLastActiveNode = function () {
                return this.mo_LastActiveNode;
            }),
            (e.prototype.SetActiveNode = function (e) {
                (this.mo_LastActiveNode = this.mo_ActiveNode),
                    (this.mo_ActiveNode = e),
                    null !== this.mo_ParentNode && this.mo_ParentNode.SetActiveNode(e);
            }),
            (e.prototype.GetDebugName = function () {
                return this.mz_DebugName;
            }),
            (e.prototype._SetParentNode = function (e) {
                this.mo_ParentNode = e;
            }),
            (e.prototype._bCheckIndex = function (e) {
                return e >= 0 && e < this.mul_ChildNodeCount;
            }),
            e
        );
    })();
n.BevNode = a;
